#ifndef _GUI_MAP_CELL_VIEWER_H
#define _GUI_MAP_CELL_VIEWER_H

namespace CEGUI
{
	class Window;
	class MultiColumnList;
	class ListboxItem;
	class CheckBox;
};



namespace GUI
{

	class MapCellViewer 
	{
	public:
		MapCellViewer(CEGUI::Window *parentSheet);
		~MapCellViewer();
		// should be in some base class :/
		void update();
		bool valueChanged(const CEGUI::EventArgs &evt);	

		bool flagChanged(const CEGUI::EventArgs &evt);	

		bool occupationChanged(const CEGUI::EventArgs &evt);	

		bool startRaep(const CEGUI::EventArgs &evt);	
	private:
		// stores the layout
		CEGUI::Window *mWindow;
		
		// list of values from the MapCell struct
		CEGUI::MultiColumnList *mValueList;

		CEGUI::ListboxItem *mNames[15];
		CEGUI::ListboxItem *mValues[15];
		CEGUI::Checkbox *mFlags[32];
		CEGUI::Checkbox *mOccupations[32];

		// cell selection widget
	//	Ogre::SceneNode *mSelectionWidget;
		// cells visible in the game window
//		Ogre::SceneNode *mGameVisibleCells;

//		bool mWidgetDisplayed;

		long *mCursorX,*mCursorY,*mCursorZ;
	
		long mOldCursorX,mOldCursorY,mOldCursorZ;
		bool mEditing;
		bool mUpdatingFlags;
		bool mBlockRaep;
		void blockRaep();
		
		struct 
		{
			WORD  blockType;
			DWORD MapDesignations;
			DWORD MapOccupations;
			BYTE  unknown1;		
			DWORD pathFinding;	
			WORD  unknown2;		
			WORD  unknown3;		
			WORD  unknown4;		
			WORD  temperature1;	
			WORD  temperature2;	
			WORD  unknown5;		
			WORD  unknown6;		
		} mOldVals;
		WORD mRaepBlock;
		DWORD mOldFlag;
		DWORD mFlagCounter;
		BYTE mWetness;
		BYTE mLayerID;
		BYTE mUnknownID;

		void populateValueList();
		//bool widgetToggled();
	};
;}


#endif